function () {
    function injectJsCode(code) {
        var scr = document.createElement("script");
        scr.type = "text/javascript";
        scr.innerText = code;
        (document.body || document.documentElement).appendChild(scr);
    }

    function injectJsFile(fileName, onComplete) {
        var scr = document.createElement("script");
        scr.type = "text/javascript";

        if (onComplete) {
            scr.onreadystatechange = function () {
                if (this.readyState === 'complete') onComplete();
            };
            scr.onload = onComplete;
        }

        scr.src = fileName;
        (document.body || document.documentElement).appendChild(scr);
    }
    
      var moduleList1 = ["../libs/jquery-1.7.js", "../utils/wsoverhttp.js", "../libs/base64.js"];
      var moduleList2 = ["IECoreStartup.js", "../libs/stacktrace.js", "../utils/RtLog.js"];
      var moduleList3 = ["../common/AgentAPI.js", "../utils/RtUtils.js", "IESpecific.js", "../utils/amf.js", "../utils/Timer.js",
    "../common/RtVersion.js", "../common/RtMessage.js", "../common/MessengerBase.js", "../common/WsMessenger.js",
    "IDEMsgProc.js", "AgentCore.js", "Recorder.js", "PageMessenger.js", "PageRequestHandler.js",
    "../libs/selenium-logging.js", "../libs/selenium-browserdetect.js", "../libs/htmlutils.js", "../libs/selenium-browserbot.js",
    "../inpage/IEBrowserSpecificInjected.js", "../inpage/AutomationClassInfo.js", "../inpage/RtEventDescriptor.js",
    "../inpage/RtPropertyDescriptor.js", "../inpage/RtMethodDescriptor.js", "../inpage/RtEnvironment.js",
    "../inpage/AutomationEvents.js", "../inpage/Automation.js", "../inpage/codecs/AutomationObjectDecodeError.js",
    "../inpage/codecs/BaseCodec.js","../inpage/codecs/ObjectNetEncoder.js","../inpage/codecs/KeyCodeCodec.js",
    "../inpage/codecs/KeyModifierCodec.js","../inpage/codecs/AutomationObjectCodec.js","../inpage/CodecHelper.js",
    "../inpage/RtRegExp.js","../inpage/RtLocator.js","../inpage/RecorderInPage.js", "../inpage/DelegateBase.js",
    "../inpage/HTMLUIWidget.js", "../html/HTMLMisc.js","../html/HTMLSelect.js","../html/HTMLInput.js",
    "../html/HTMLTextArea.js","../html/HTMLAnchor.js","../html/HTMLDocument.js","../html/HTMLOption.js",
    "../html/HTMLIFrame.js","../extjs/ExtComponent.js","../extjs/ExtContainer.js","../extjs/ExtButton.js",
    "../extjs/ExtTreePanel.js","../extjs/ExtToolbar.js","../extjs/ExtMenu.js","../extjs/ExtGrid.js",
    "../extjs/ExtTab.js","../extjs/ExtWindow.js","../extjs/ExtForm.js","../extjs/ExtDatePicker.js",
    "../inpage/RtReplayResult.js","../inpage/OverrideMethods.js","../inpage/GlobalMethods.js",
    "../inpage/MiscFuncs.js","../inpage/AlertManager.js","../inpage/MessageProcessorInPage.js",
    "../inpage/AgentRequestHandler.js","../inpage/RtMessengerInPage.js","../inpage/Inspection.js"];
    
      var moduleList;
	  var loadingIndex;
	  var modulesRootUrl;
	
	  function loadNextModule(onComplete) {
	    if (loadingIndex < moduleList.length) {
	      var fileName = moduleList[loadingIndex];
	      loadingIndex++;
	       injectJsFile(fileName, function() {
	           loadNextModule(onComplete);
	       });
	    }
	    else {
	       if (onComplete) {
	           onComplete();
	       }
	    }
	  }
	
	  function loadModules(modules, onComplete) {
	    moduleList = modules;
	    loadingIndex = 0;
	    alert(moduleList.length);
	    loadNextModule(onComplete);
	  }
	  
      loadModules(moduleList1, function() {
	       injectJsCode("if (!window.btoa) window.btoa = base64.encode;if (!window.atob) window.atob = base64.decode;");
      });
      loadModules(moduleList2, function() {
           injectJsCode("RIATest.RtLog.enableLocalLogging();");
      });
      loadModules(moduleList3, function() {
           injectJsCode("RIATest.AgentCore.startAgent();");
      });
}